package com.study.basetype.enums;

/**
 * @author flwu
 * @date 2020/3/19 12:37 AM
 * @MOTTO 保持空杯和敬畏
 */
public enum  SexEnum {

    MEN(1, "男"),
    WOMEN(2, "女");

    private Integer code;
    private String desc;

    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    SexEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static SexEnum getSexEnum(Integer code) {
        for(SexEnum sexEnum : SexEnum.values()) {
            if (sexEnum.code.equals(code)) {
                return sexEnum;
            }
        }
        return null;
    }
}
